﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Media.Imaging;

namespace Asteroids.Game.PowerUps
{
    class Laser : TimedPowerUp
    {
        public Laser(Coordinate location) : base(location)
        {
            Img = new BitmapImage(new Uri(Path.GetDirectoryName(Application.ExecutablePath) + "/laser.jpg"));

            Type = PowerUpType.Laser;
            PowerUpProbability = 4;
            PowerUpDuration = 120;
        }

        private Ammo old;
        public override void PerformAction(Player player)
        {
            Console.WriteLine("You got a Laser");

            old = player.CurrentShip.CurrentWeapon.CurrentAmmo;
            player.CurrentShip.CurrentWeapon.CurrentAmmo = Ammo.Beam;
            Subscribe(player);
        }

        public override object Clone()
        {
            return new Laser(Location);
        }

        protected override void UndoPerformAction(Player player)
        {
            player.CurrentShip.CurrentWeapon.CurrentAmmo = old;
        }
    }
}
